<template>
	<!-- 处理滚动穿透 -->
	<page-meta :page-style="'overflow:'+(show?'hidden':'visible')"></page-meta>

	<view class="content">
		<view class="nav-style" :style="'height:'+navHeight+'px;padding-top:'+statusBarHeight+'px;'" v-if="navHeight">
			<view class="height-bg"
				:style="top ? 'display:flex;justify-content:flex-end;height:'+(navHeight+statusBarHeight)+'px;z-index:10;' : '' ">
				<swiper style="height: 580rpx;" :autoplay="true" :circular="true">
					<swiper-item v-for="(item, index) in bannerList" :key="index">
						<view @click="aboutLearnMore(item.h5Url)">
							<image :src="baseUrl + item.imagesUrl" style="width: 100%;height: 580rpx;"
								mode="aspectFill"></image>
						</view>
					</swiper-item>
					<!-- <swiper-item>
						<video :src="videoList[0].coverUrl" style="width: 100%;height: 580rpx;"></video>
					</swiper-item> -->
				</swiper>
			</view>
			<view class="baseNames">哇咔咔wakaka</view>
			<view class="nav-stylebox">
				<uni-icons type="location"></uni-icons>
				<view class="nav-text">
					<picker @change="toChangeAddress" :value="skiingAddress.index" range-key="snowDesc"
						:range="skiingAddress.address">
						<view class="uni-input">{{skiingAddress.address[skiingAddress.index].snowDesc}}</view>
					</picker>
					<uni-icons type="bottom"></uni-icons>
				</view>
			</view>
		</view>

		<view class="index-content" :style="navHeight ? 'margin-top:'+(navHeight+statusBarHeight+120)+'px;':''">
			<view class="my-video">
				<view class="video-box">
					<view class="video-tops">
						<view style="display: flex;align-items: center;">
							<view class="header">
								<image mode="aspectFill" :src="isHasLogin? userInfo.face : imageUrl + 'noPic.jpg' "></image>
							</view>
							<view class="message">
								<h2>{{isHasLogin? userInfo.nickName : "未登录"}}</h2>
								<p>{{skiingAddress.address[skiingAddress.index].snowDesc}}</p>
							</view>
						</view>
						<view class="links">
							<view class="big-text" @click="toPage('/pages/fodder/index')">
								<span>我的素材</span>
							</view>
						</view>
					</view>
					<view class="video-bottoms">
						<view class="iconBox">
							<image :src="imageUrl + 'index/image.png'" mode="aspectFit"></image>
							<text>照片{{userVideoNum >50? "50+" : userVideoNum}}张</text>
						</view>
						<view class="iconBox">
							<image :src="imageUrl + 'index/video.png'" mode="aspectFit"></image>
							<text>视频{{userImageNum >50? "50+" : userImageNum}}条</text>
						</view>
					</view>
				</view>
			</view>
			<view class="video-wonderful">
				<view class="video-titles">
					<span v-for="(item,index) in tabVideos" :key="index" :class="item == tabTitle ?'active':''"
						@click="changeTitle(item)">{{item}}</span>
				</view>
				<view class="wonderful-box">
					<view class="video-Box1" v-if="tabTitle == '精彩视频'">
						<scroll-view class="scroll-box" @scrolltolower="onScrollToLower" :scroll-y="true">
							<view class="list-box">
								<view v-for="(item,index) in videoList" :key="index" class="lists">
									<image @click="playVideo(item.mediaId)" :src="item.coverUrl" v-if="item.coverUrl"
										mode="widthFix"></image>
									<view @click="playVideo(item.mediaId)" class="play">
										<image :src="imageUrl + 'index/play-index.png'" mode="aspectFit"></image>
									</view>
									<p>
										<span>{{item.duration + '"'}}</span>
										<b>
											<span @click="yuepaiBtn" :class="item.isYuepai ? 'yuepai':''">
												<image
													:src="item.isYuepai ? imageUrl + 'index/yp-active.png' : imageUrl + 'index/yp.png'"
													mode="aspectFit"></image>
												<i>{{ item.isYuepai?'已约拍':'约拍' }}</i>
											</span>
											<span @click="islikeBtn(item)" :class="item.isLike?'like':''">
												<image
													:src="item.isLike ? imageUrl + 'index/heart-filled.png' : imageUrl + 'index/heart.png'"
													mode="aspectFit"></image>
												<i>{{item.isLike? 1:0}}</i>
											</span>
										</b>
									</p>
								</view>
							</view>
							<view class="srcoll-bottom">
								<p v-if="videoEnd">加载中...</p>
								<p v-else>没有更多了~</p>
							</view>
						</scroll-view>
					</view>
					<view class="video-Box1" v-if="tabTitle == '精彩照片'">
						<scroll-view class="scroll-box" @scrolltolower="onScrollToLowerImage" :scroll-y="true">
							<view class="list-box">
								<view v-for="(item,index) in imageList" :key="index" class="lists" style="position: relative;">
									<image @click="previewImage(item.coverUrl)" :src="item.coverUrl"
										v-if="item.coverUrl" mode="widthFix"></image>
									<p>
										<b>
											<span @click="yuepaiBtn" :class="item.isYuepai ? 'yuepai':''">
												<image
													:src="item.isYuepai ? imageUrl + 'index/yp-active.png' : imageUrl + 'index/yp.png'"
													mode="aspectFit"></image>
												<i>{{ item.isYuepai?'已约拍':'约拍' }}</i>
											</span>
											<span @click="islikeBtn(item)" :class="item.isLike?'like':''">
												<image
													:src="item.isLike ? imageUrl + 'index/heart-filled.png' : imageUrl + 'index/heart.png'"
													mode="aspectFit"></image>
												<i>{{item.isLike? 1:0}}</i>
											</span>
										</b>
									</p>
								</view>
							</view>
							<view class="srcoll-bottom">
								<p v-if="imageEnd">加载中...</p>
								<p v-else>没有更多了~</p>
							</view>
						</scroll-view>
					</view>

				</view>
			</view>
		</view>

		<view class="indexlogin-box" v-if="loginPic">
			<view class="icons" @click="loginPic = false">
				<uni-icons type="closeempty"></uni-icons>
			</view>
			<view class="texts">为了保障AI正确匹配您的摄影资料，若您更换了 滑雪装备请更新个人身份信息资料！</view>
			<view class="buttons">
				<button @click="toAddMessage()">立即前往</button>
			</view>
		</view>
		<!-- 普通弹窗  -->
		<uni-popup ref="popupLoginForm" class="popup-contentBox">
			<view class="popup-content">
				<view class="loginForm-title">
					<uni-icons type="closeempty" @click="toCloseLogin()"></uni-icons>
					<view>个人图片注册</view>
				</view>
				<view class="message-popup">
					<h3>请上传正面照一张</h3>
					<view class="upLoad-pic">
						<view class="pic-box">
							<view class="pic-border" @click="getFullFacePhoto">
								<view>
									<image mode="aspectFit" :src="FullFacePhoto" v-if="FullFacePhoto"></image>
									<image mode="aspectFit" :src="imageUrl + 'header.png'" v-else></image>
								</view>
							</view>
							<view class="pic-texts">拍摄人脸正面像</view>
						</view>
					</view>
					<h3>请上传全身照两张</h3>
					<view class="upLoad-pic">
						<view class="pic-box">
							<view class="pic-border" @click="getFullBodyPhoto">
								<view>
									<image mode="aspectFit" :src="FullBodyPhoto" v-if="FullBodyPhoto"></image>
									<image mode="aspectFit" :src="imageUrl + 'man.png'" v-else></image>
								</view>
							</view>
							<view class="pic-texts">拍摄全身像正面</view>
						</view>
						<view class="pic-box">
							<view class="pic-border" @click="getFullCeBodyPhoto">
								<view>
									<image mode="aspectFit" :src="FullCeBodyPhoto" v-if="FullCeBodyPhoto"></image>
									<image mode="aspectFit" :src="imageUrl + 'man-left.png'" v-else></image>
								</view>
							</view>
							<view class="pic-texts">拍摄全身像侧面</view>
						</view>
					</view>
					<button @click="comitBtn">提交</button>
					<view class="tips">
						<h2>温馨提示</h2>
						<view>1、为保障系统AI精准匹配您的摄影资料，请您完整上传清晰的人脸照及全身照。</view>
						<view>2、当您的着装、滑雪装备或发生改变时请及时更新人像资料以保证系统AI精准匹配您的摄影资料。</view>
					</view>
				</view>
			</view>
		</uni-popup>
		<!-- 雪场选择器 -->
		<uni-popup ref="popupSkiing" class="skiing-Box" background-color="#ffffff">
			<view class="skiing-list">
				<uni-indexed-list :options="skiingList" :showSelect="true" @click="bindClick"></uni-indexed-list>
			</view>
		</uni-popup>

		<!-- 视频播放弹窗  background-color="#ffffff" -->
		<uni-popup @maskClick="maskclick" ref="popupskiingVideo" class="skiingVideo-Box" @change="change">
			<view class="skiingVideo-list">
				<view class="title">
					<uni-icons type="closeempty" @click="toCloseVideo()"></uni-icons>
					<span>素材预览</span>
				</view>
				<video style="width: 100%;" v-if="indexVideo" :src="indexVideo">
					<view class="shuiyin">哇咔咔wakaka</view>
					<view class="skiingVideo-button">
						<image @click="linkBtn" :src="isLikeBtn ? imageUrl + 'index/heart-filled.png' : imageUrl + 'index/heart.png'" mode="aspectFit"></image>
						<image @click="yueBtn" :src="imageUrl + 'index/yp.png'" mode="aspectFit"></image>
						<!-- <view>{{indexVideoLikeTime}}</view> -->
					</view>
				</video>
				<!-- <video style="width: 100%;" v-if="indexVideo" :src="indexVideo"></video> -->
				<!-- 点赞 -->
			</view>
		</uni-popup>
		
		<!-- 图片预览弹窗 -->
		<uni-popup ref="popupImageLook" class="">
			<view class="imageBigs">
				<view class="text">
					哇咔咔wakaka
				</view>
				<image :src="popupImageSrc" mode="aspectFit"></image>
			</view>
		</uni-popup>
	</view>

</template>

<script>
	import {
		snowFieldList,
		getSnowFieldByPosition,
		getMemberInfo,
		registerImageInfo,
		bannerList,
	} from '@/api/index.js'
	import {
		getCreateMedia,
		getMediaInfoi,
		searchMedia
	} from '@/api/service.js'
	import {
		getUserInfo,
		getSnowInfo
	} from '@/api/login.js'
	import {
		getSnowToken,
		getUserData,
		getToken,
		setSnowToken,
		getHasLogin
	} from '@/utils/storage.js'

	import env from '@/utils/config.js'
	import videoPlay from '@/pages/index/components/video-play/video-play.vue'
	import CCBProjectList from '@/uni_modules/cc-pullScroolView/components/cc-pullScroolView/cc-pullScroolView.vue'
	import upLoadFile from '@/utils/uploadFile.js'
	import imageConfig from '@/utils/images.js'
	export default {
		components: {
			videoPlay,
			CCBProjectList
		},
		data() {
			return {
				isHasLogin: getHasLogin(), // 判断是否登录
				baseUrl: env.baseURL,
				imageUrl: imageConfig.uploadImageUrl,
				popupImageSrc: "", // 预览图片地址
				show: false, // 滚动穿透开关
				bannerList: [], //banner图片列表
				videoList: [], // 存放视频列表
				imageList: [], //存放照片列表
				videoPage: 1, // 获取视频页
				videoTotal: 0, // 视频总数
				videoEnd: false, // 视频获取完毕
				imagePage: 1, // 获取图片页
				imageTotal: 0, // 图片总数
				imageEnd: false, // 图片获取完毕
				navHeight: 0, //整体顶部导航栏的高度
				statusBarHeight: 0, //状态栏高度
				tabVideos: ["精彩视频", "精彩照片"],
				tabTitle: "精彩视频",
				// 用于调整视频组件
				videoTitle: "",
				videoType: "",
				firstPic: "",
				// 存放视频弹窗
				indexVideo: null,
				// 选择雪场数组
				skiingAddress: {
					address: [],
					index: 0,
				},
				indexVideoLikeTime: 0,
				indexVideoIsLike: false,
				indexYuepaiIsLike: false,
				// 用户信息
				userInfo: {},
				//人脸正面像
				FullFacePhoto: '',
				FullFacePhotoId: '',
				// 全身像正面
				FullBodyPhoto: '',
				FullBodyPhoto: '',
				// 全身像侧面
				FullCeBodyPhoto: '',
				FullCeBodyPhoto: '',
				// 照片对应的媒资id
				mediaIds: [],
				address: {
					longitude: 0,
					latitude: 0,
				},
				isLikeBtn: false, // 弹窗内点赞，效果展示
				userVideoNum: 0, // 个人视频数量
				userImageNum: 0, // 个人图片数量
				loginPic:true
			}
		},
		onShow() {
			this.userInfo = this.$options.filters.isLogin()
		},
		onLoad() {
			// let token = getToken('access_token_key')
			//获取手机系统的信息（在这主要是获取状态栏和胶囊的高度）
			let {
				statusBarHeight,
				system
			} = uni.getSystemInfoSync()
			this.statusBarHeight = statusBarHeight
			this.navHeight = statusBarHeight + (system.indexOf('iOS') > -1 ? 44 : 48)
			// 获取雪场数据
			this.getSkiing()
			// 获取精彩照片和视频
			this.sendRequest()
			// 在页面加载时开始定时发送请求
			// this.intervalId = setInterval(this.sendRequest, 5000);
		},
		methods: {
			// 跳转外部链接h5
			aboutLearnMore(url) {
				if (url.includes("https://")) {
					const newUrl = url.split("https://")
					// this.h5Url = url
					uni.navigateTo({
						url: '/pages/index/components/web-views/web-views?url=' + newUrl[1]
					})
				} else if (url.includes("www.")) {
					uni.navigateTo({
						url: '/pages/index/components/web-views/web-views?url=' + url
					})
				}
			},

			// 获取banner图事件
			getBannerList() {
				bannerList({
					bannerType: 'HOME_PAGE', //banner类型
					isAsc: 'desc', //排序的方向desc或者asc
					pageNum: '1', //当前记录起始索引
					pageSize: '5', //每页显示记录数
				}).then(res => {
					this.bannerList = res.rows
				})
			},

			// 获取首页精彩视频和图片
			sendRequest() {
				// 首页获取视频
				searchMedia({
					Action: 'SearchMedia',
					userId: getUserData().id,
					mediaType: 'Video',
					ownerType: 'Public',
					mamEntityId: 'SkiingClip',
					pageNo: 1,
					pageSize: 10
				}).then(res => {
					const aa = res.mediaInfoList.map(item => {
						return {
							coverUrl: item.coverUrl,
							dynamicMetaData: item.dynamicMetaData,
							mamEntityId: item.mamEntityId,
							mediaId: item.mediaId,
							mediaType: item.mediaType,
							status: item.status,
							title: item.title,
							duration: new Date(item.duration * 1000).toISOString().substr(14, 5).replace(
								':', "'")
						}
					})
					this.videoList = aa
					this.videoTotal = res.total
				})
				// 照片
				searchMedia({
					Action: 'SearchMedia',
					userId: getUserData().id,
					mediaType: 'Image',
					ownerType: 'Public',
					mamEntityId: 'SkiingClip',
					pageNo: 1,
					pageSize: 10
				}).then(res => {
					this.imageList = res.mediaInfoList
					this.imageTotal = res.total
				})
			},
			// 视频下拉刷新
			onScrollToLower() {
				// 滚动触底事件处理逻辑
				if (this.videoPage === Math.ceil(this.videoTotal / 10)) {
					this.videoEnd = false
				} else {
					this.videoEnd = true
					searchMedia({
						Action: 'SearchMedia',
						userId: getUserData().id,
						mediaType: 'Video',
						ownerType: 'Public',
						mamEntityId: 'SkiingClip',
						pageNo: ++this.videoPage,
						pageSize: 10
					}).then(res => {
						const aa = res.mediaInfoList.map(item => {
							return {
								coverUrl: item.coverUrl,
								dynamicMetaData: item.dynamicMetaData,
								mamEntityId: item.mamEntityId,
								mediaId: item.mediaId,
								mediaType: item.mediaType,
								status: item.status,
								title: item.title,
								duration: new Date(item.duration * 1000).toISOString().substr(14, 5)
									.replace(':', "'")
							}
						})
						this.videoList = [...this.videoList, ...aa]
					})
				}
			},
			// 照片下拉刷新
			onScrollToLowerImage() {
				// 滚动触底事件处理逻辑
				if (this.imagePage === Math.ceil(this.imageTotal / 10)) {
					this.imageEnd = false
				} else {
					this.imageEnd = true
					searchMedia({
						Action: 'SearchMedia',
						userId: getUserData().id,
						mediaType: 'Video',
						ownerType: 'Public',
						mamEntityId: 'SkiingClip',
						pageNo: ++this.imagePage,
						pageSize: 10
					}).then(res => {
						this.imageList = [...this.imageList, ...res.mediaInfoList]
					})
				}
			},
			// 获取用户信息
			getUserInfo() {
				getUserInfo().then(res => {})
			},
			// 约拍跳转
			yuepaiBtn() {
				uni.switchTab({
					url: "/pages/yuepai/index"
				})
			},
			// 列表点赞
			islikeBtn(item) {
				if (item.isLike) {
					item.isLike = false
				} else {
					this.$set(item, "isLike", true)
				}
			},
			// 点赞
			linkBtn() {
				if (this.isLikeBtn) {
					this.isLikeBtn = false
					// this.indexVideoLikeTime--
					return
				}
				this.isLikeBtn = true
				// this.indexVideoLikeTime++
			},
			// 雪场选择器
			bindClick(e) {},
			// 开启定位,获取地址，未知原因但是没有执行地址方法
			getAddress() {
				let that = this
				// 获取用户是否开启 授权获取当前的地理位置、速度的权限。
				uni.getSetting({
					success(res) {
						// 如果没有授权
						if (!res.authSetting['scope.userLocation']) {
							// 则拉起授权窗口
							uni.authorize({
								scope: 'scope.userLocation',
								success() {
									//点击允许后--就一直会进入成功授权的回调 就可以使用获取的方法了
									uni.getLocation({
										type: 'wgs84',
										success: function(res) {
											that.address.longitude = res.longitude
											that.address.latitude = res.latitude
											uni.showToast({
												title: '当前位置的经纬度：' + res.longitude +
													',' + res.latitude,
												icon: 'success',
												mask: true
											})
										},
									})
								},
								fail(error) {
									//点击了拒绝授权后--就一直会进入失败回调函数--此时就可以在这里重新拉起授权窗口
									uni.showModal({
										title: '提示',
										content: '若点击不授权，将无法使用位置功能',
										cancelText: '不授权',
										cancelColor: '#999',
										confirmText: '授权',
										confirmColor: '#f94218',
										success(res) {
											if (res.confirm) {
												// 选择弹框内授权
												uni.openSetting({
													success(res) {}
												})
											} else if (res.cancel) {
												// 选择弹框内 不授权
											}
										}
									})
								}
							})
						} else {
							// 有权限则直接获取
							uni.getLocation({
								type: 'wgs84',
								success: function(res) {
									that.address.longitude = res.longitude
									that.address.latitude = res.latitude
									getSnowInfo({
										longitude: res.longitude,
										latitude: res.latitude
									}).then((res) => {
										if (res.code === 200) {
											if (!res.data) {
												uni.showToast({
													title: "当前城市无雪场",
													icon: "error"
												})
											}
											setSnowToken(res.data.id);
										} else {}
									})
									// 判断最近雪场
									getSnowFieldByPosition({
										longitude: res.longitude,
										latitude: res.latitude
									}).then(acc => {
										that.skiingAddress.address = that.skiingAddress.address
											.filter(item => item.snowDesc !== acc.data
												.snowDesc)
										that.skiingAddress.address.unshift(acc.data)
										setSnowToken(acc.data.id);
										if (acc.data.id) {
											that.getMemberInfo()
										} else {
											uni.showToast({
												title: '当前位置无雪场',
												icon: 'error',
											})
										}

									})
								},
								fail(error) {
									uni.showToast({
										title: '请勿频繁调用！',
										icon: 'none',
									})
								}
							})
						}
					}
				})
			},
			// 获取当前小程序用户信息(包括是否注册证明)
			getMemberInfo() {
				let snowFieldId = getSnowToken('snow_field')
				getMemberInfo(snowFieldId).then(add => {
					uni.setStorageSync("attestationFlag",add.data.attestationFlag)
					this.userImageNum = add.data.imageMaterialsNumber || 0
					this.userVideoNum = add.data.videoMaterialsNumber || 0
					console.log(add,'用户信息')
					if (add.data.attestationFlag) {
						uni.showToast({
							title: '用户已注册',
							icon: 'none'
						})
						this.loginPic = false
					} else {
						uni.showToast({
							title: '用户无注册',
							icon: 'none'
						})
					}
				})
			},

			// 页面跳转--我的素材
			toPage(url) {
				uni.navigateTo({
					url: '/pages/fodder/index'
				})
			},
			// 顶部按钮弹出选择地址
			toChangeAddress(e) {
				this.skiingAddress.index = e.detail.value
			},
			// 底部弹窗，用于修改个人信息
			toAddMessage() {
				this.$refs.popupLoginForm.open('bottom')
			},
			// 关闭底部弹窗
			toCloseLogin() {
				this.$refs.popupLoginForm.close()
				this.FullFacePhoto = ''
				this.FullBodyPhoto = ''
				this.FullCeBodyPhoto = ''
			},
			// 关闭视频弹窗
			toCloseVideo() {
				this.indexVideo = null
				this.$refs.popupskiingVideo.close()
			},
			// 点击蒙版关闭视频弹窗
			maskclick() {
				this.indexVideo = null
			},
			// 切换视频还是照片
			changeTitle(name) {
				this.tabTitle = name
			},
			// 视频播放change事件
			change(e) {
				this.show = e.show
			},
			// 图片预览
			previewImage(image) {		
				this.$refs.popupImageLook.open("center")
				this.popupImageSrc = image
				// uni.previewImage({
				// 	// current: image,
				// 	urls: [image],
				// 	success: () => {
						
				// 	},
				// 	fail: (err) => {
						
				// 	}
				// });
			},
			// 雪场列表
			getSkiing() {
				snowFieldList().then(res => {
					if(res){
						this.skiingAddress.address = res.data
						// 开启定位
						this.getAddress()
						// 获取banner图列表
						this.getBannerList()
						// 获取用户信息
						this.getUserInfo()
					}
				})
			},
			// 播放视频
			playVideo(id) {
				// this.indexVideo = video
				getMediaInfoi({
					Action: 'GetMediaInfo',
					userId: getUserData().id,
					mediaId: id,
					urlUseage: 'Play'
				}).then(res => {
					this.indexVideo = res.GetMediaInfoResult.MediaInfo.FileInfoList[0].FileBasicInfo.FileUrl
				})
				this.$refs.popupskiingVideo.open("bottom")
			},

			// 约拍
			yueBtn() {
				uni.switchTab({
					url: "/pages/yuepai/index"
				})
				this.$refs.popupskiingVideo.close()
			},

			// 拍摄人脸正面像
			getFullFacePhoto() {
				uni.chooseImage({
					count: '1', //最多可以选择的图片张数
					sourceType: ['album', 'camera'], //album 从相册选图，camera 使用相机
					success: (res) => {
						// 文件路径
						const filePath = res.tempFilePaths[0]
						// 获取文件名
						const fileName = '人脸正面像'
						// 获取扩展名
						const extension = filePath.split(".").pop()
						// 上传图片
						upLoadFile.upload(filePath, 'FullFacePhoto', res => {
							if (res) {
								this.FullFacePhoto = res.ossFileName
								this.FullFacePhotoId = res.mediaId
							}
						})

					}
				})
			},
			// 拍摄全身像正面
			getFullBodyPhoto() {
				uni.chooseImage({
					count: '1', //最多可以选择的图片张数
					sourceType: ['album', 'camera'], //album 从相册选图，camera 使用相机
					success: (res) => {
						// 文件路径
						const filePath = res.tempFilePaths[0]
						// 获取文件名
						const fileName = '全身像正面'
						// 获取扩展名
						const extension = filePath.split(".").pop()
						// 上传图片
						upLoadFile.upload(filePath, 'FullBodyPhoto', res => {
							if (res) {
								this.FullBodyPhoto = res.ossFileName
								this.FullBodyPhotoId = res.mediaId
							}
						})
					}
				})
			},
			// 拍摄全身像侧面
			getFullCeBodyPhoto() {
				uni.chooseImage({
					count: '1', //最多可以选择的图片张数
					sourceType: ['album', 'camera'], //album 从相册选图，camera 使用相机
					success: (res) => {
						// 文件路径
						const filePath = res.tempFilePaths[0]
						// 获取文件名
						const fileName = '全身像侧面'
						// 获取扩展名
						const extension = filePath.split(".").pop()
						// 上传图片
						upLoadFile.upload(filePath, 'FullCeBodyPhoto', res => {
							if (res) {
								this.FullCeBodyPhoto = res.ossFileName
								this.FullCeBodyPhotoId = res.mediaId
							}
						})
					}
				})
			},

			// 提交信息
			comitBtn() {
				let data = {
					frontalView: this.FullFacePhoto, //正面照
					frontalViewMediaId: this.FullFacePhotoId, //正面照媒资id（逗号分隔）
					fullBodyPhoto: this.FullBodyPhoto + ',' + this.FullCeBodyPhoto, //全身照
					fullBodyPhotoMediaId: this.FullBodyPhotoId + ',' + this.FullCeBodyPhotoId, //fullBodyPhotoMediaId
					memberId: getUserData().id, //用户id
					snowFieldId: getSnowToken('snow_field'), //雪场id
				}
				registerImageInfo(data).then(res => {
					if (res.code == 200) {
						uni.showToast({
							title: '个人注册成功',
							icon: 'none'
						})
						this.$refs.popupLoginForm.close()
					} else {
						uni.showToast({
							title: '个人注册失败',
							icon: 'none'
						})
					}
					this.$refs.popupLoginForm.close()
				})
			},

		}
	}
</script>

<style lang="less">
	@import url('../../static/style/index.less');
</style>